<template>
  <div class="game-over">
    <div class="game-over-content">
      <h1>游戏结束</h1>
      <div class="score-summary">
        <div class="final-score">
          <div class="score-label">最终得分</div>
          <div class="score-value">{{ score }}</div>
        </div>
        <div class="high-score">
          <div class="high-score-label">最高分</div>
          <div class="high-score-value">{{ highScore }}</div>
        </div>
      </div>
      <div class="result-message">
        {{ resultMessage }}
      </div>
      <button class="restart-button" @click="$emit('restart')">
        再来一局
      </button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'GameOver',
  props: {
    score: {
      type: Number,
      required: true
    },
    highScore: {
      type: Number,
      required: true
    }
  },
  computed: {
    resultMessage() {
      if (this.score === 0) {
        return '别灰心，再试一次吧！'
      } else if (this.score < 5) {
        return '还不错，继续努力！'
      } else if (this.score < 10) {
        return '很棒的成绩！'
      } else if (this.score < 20) {
        return '太厉害了！'
      } else {
        return '你是跳一跳高手！'
      }
    }
  }
}
</script>

<style scoped>
.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.game-over-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  max-width: 80%;
}

h1 {
  color: #F44336;
  margin-bottom: 20px;
}

.score-summary {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
}

.final-score, .high-score {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 10px;
  min-width: 120px;
}

.score-label, .high-score-label {
  font-size: 16px;
  margin-bottom: 5px;
  color: #666;
}

.score-value {
  font-size: 28px;
  font-weight: bold;
  color: #FF5722;
}

.high-score-value {
  font-size: 28px;
  font-weight: bold;
  color: #4CAF50;
}

.result-message {
  font-size: 20px;
  margin: 20px 0;
  color: #333;
}

.restart-button {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 18px;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.3s;
}

.restart-button:hover {
  background: #45a049;
}
</style>